﻿@using ExpressManagement.Areas.BackSys.ServiceTools;
@using DAL.Models;
@using Microsoft.AspNetCore.Http;
@*@model List<DAL.Bag>[]*@
@{
    Layout = "../Shared/_LayoutBase.cshtml";
    var sess = Context.Session;
    string loginType = sess.GetString("loginType");
    //int page = 0;
    //int rows = 0;
    //int totalPages = 0;
    //int senderTotalPages = 0;
    //int getterPage = 0;
    //int getterRows = 0;
    //int getterTotalPages = 0;
    //if (loginType.Equals("用户"))
    //{

    //    senderPage = Convert.ToInt16(MySession.GetSession("senderPage"));
    //    senderRows = Convert.ToInt16(MySession.GetSession("senderRows"));
    //    senderTotalPages = Convert.ToInt16(MySession.GetSession("senderTotalPages"));
    //    getterPage = Convert.ToInt16(MySession.GetSession("getterPage"));
    //    getterRows = Convert.ToInt16(MySession.GetSession("getterRows"));
    //    getterTotalPages = Convert.ToInt16(MySession.GetSession("getterTotalPages"));
    //}
    //else
    //{
    //    page = Convert.ToInt16(MySession.GetSession("bagPage"));
    //    rows = Convert.ToInt16(MySession.GetSession("bagRows"));
    //    totalPages = Convert.ToInt16(MySession.GetSession("bagTotalPages"));
    //}

}
@section CssLink{


}

<section  id="app">
    <!-- header section end-->
    <!-- page heading start-->
    <div class="page-heading">
        <h3>
            快递数据
        </h3>
        <ul class="breadcrumb">
            <li>
                <a href="">物流管理系统</a>
            </li>
            <li>
                <a href="">快递管理</a>
            </li>
            <li class="active"> 快递数据表 </li>
        </ul>
    </div>
    <!-- page heading end-->
    <!--body wrapper start-->
    <div class="wrapper">
        @if (loginType.Equals("用户"))
        {
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">

                        <header class="panel-heading">
                            由您寄出的快递
                            <span class="tools pull-right">
                                <a href="javascript:;" class="fa fa-chevron-down"></a>
                                <a href="javascript:;" class="fa fa-times"></a>
                            </span>
                        </header>
                        <div class="panel-body">
                            <div class="adv-table">
                                <table class="display table table-bordered table-striped">
                                    <thead>
                                        <tr>

                                            <th>包裹号</th>
                                            <th>寄出日期</th>
                                            <th>收件人姓名</th>
                                            <th>收件人电话</th>
                                            <th>收件人地址</th>
                                            <th>寄件人姓名</th>
                                            <th>寄件人电话</th>
                                            <th>寄件人地址</th>
                                            <th>寄件信息</th>
                                            <th>更新日期</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody id="table_body_sender">
                               

                                            <tr v-for="sender in senderList" class="gradeA">
                                                <td  class="center hidden-phone">{{sender.BagId}}</td>
                                                <td class="center hidden-phone">
                                                    {{formatDateTime2(sender.SendDate)}}
                                                </td>
                                                <td class="center hidden-phone">{{sender.GetterName}}</td>
                                                <td class="center hidden-phone">{{sender.GetterPhone}}</td>
                                                <td class="center hidden-phone">{{sender.GetterAddress}}</td>
                                                <td class="center hidden-phone">{{sender.SenderName}}</td>
                                                <td class="center hidden-phone">{{sender.SenderPhone}}</td>
                                                <td class="center hidden-phone">{{sender.SenderAddress}}</td>
                                                <td class="center hidden-phone">{{sender.SendInfo}}</td>
                                                <td class="center hidden-phone">{{formatDateTime2(sender.UpdateTime)}}</td>
                                                <td class="center hidden-phone">
                                                    <button  class="btn btn-default" type="button" data-toggle="modal" data-target="#dispModal" v-on:click="get_info(sender.BagId,'r')">查看</button>
                                                    <button  class="btn btn-info" type="button" data-toggle="modal" data-target="#updateModal" v-on:click="get_info(sender.BagId,'w')">修改</button>
                                                    <button  class="btn btn-danger" type="button" data-toggle="modal" data-target="#delModal" v-on:click="delete_info(sender.BagId)">删除</button>
                                                </td>
                                            </tr>
                                      


                                    </tbody>
                                    @*<tfoot>
                                            <tr>

                                                <th>包裹号</th>
                                                <th>寄出日期</th>
                                                <th>收件人姓名</th>
                                                <th>收件人电话</th>
                                                <th>收件人地址</th>
                                                <th>寄件人姓名</th>
                                                <th>寄件人电话</th>
                                                <th>寄件人地址</th>
                                                <th>寄件信息</th>
                                                <th>更新日期</th>
                                                <th>操作</th>
                                            </tr>
                                        </tfoot>*@
                                </table>
                                <ul class="pagination pull-right">
                                    <li  v-if="senderPage<=1" class="page-item disabled"><a class="page-link" >  &laquo;</a></li>
                                    <li v-else class="page-item"><a href="" v-on:click.prevent="changePage(page-1,'sender')" class="page-link">&laquo;</a></li>
                                    <li v-for="i in senderTotalPages" class="page-item"><a href="" v-on:click.prevent="changePage(i,'sender')" class="page-link">{{i}}</a></li>
                                    <li v-if="senderPage>=senderTotalPages" class="page-item disabled"><a class="page-link">&raquo;</a></li>
                                    <li v-else class="page-item"><a href="" v-on:click.prevent="changePage(page+1,'sender')" class="page-link">&raquo;</a></li>
                                </ul>
                            </div>

                        </div>
                    </section>

                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">

                        <header class="panel-heading">
                            寄给您的快递
                            <span class="tools pull-right">
                                <a href="javascript:;" class="fa fa-chevron-down"></a>
                                <a href="javascript:;" class="fa fa-times"></a>
                            </span>
                        </header>
                        <div class="panel-body">
                            <div class="adv-table">
                                <table class="display table table-bordered table-striped" @*id="dynamic-table2"*@>
                                    <thead>
                                        <tr>

                                            <th>包裹号</th>
                                            <th>寄出日期</th>
                                            <th>收件人姓名</th>
                                            <th>收件人电话</th>
                                            <th>收件人地址</th>
                                            <th>寄件人姓名</th>
                                            <th>寄件人电话</th>
                                            <th>寄件人地址</th>
                                            <th>寄件信息</th>
                                            <th>更新日期</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody id="table_body_getter">
                                     

                                            <tr class="gradeA" v-for="getter in getterList">
                                                <td  class="center hidden-phone">{{getter.BagId}}</td>
                                                <td class="center hidden-phone">
                                                    {{formatDateTime2(getter.SendDate)}}
                                                </td>
                                                <td class="center hidden-phone">{{getter.GetterName}}</td>
                                                <td class="center hidden-phone">{{getter.GetterPhone}}</td>
                                                <td class="center hidden-phone">{{getter.GetterAddress}}</td>
                                                <td class="center hidden-phone">{{getter.SenderName}}</td>
                                                <td class="center hidden-phone">{{getter.SenderPhone}}</td>
                                                <td class="center hidden-phone">{{getter.SenderAddress}}</td>
                                                <td class="center hidden-phone">{{getter.SendInfo}}</td>
                                                <td class="center hidden-phone">{{formatDateTime2(getter.UpdateTime)}}</td>
                                                <td class="center hidden-phone">
                                                    <button  class="btn btn-default" type="button" data-toggle="modal" data-target="#dispModal" v-on:click="get_info(getter.BagId,'r')">查看</button>
                                                    <button  class="btn btn-info" type="button" data-toggle="modal" data-target="#updateModal" v-on:click="get_info(getter.BagId,'w')">修改</button>
                                                    <button  class="btn btn-danger" type="button" data-toggle="modal" data-target="#delModal" v-on:click="delete_info(getter.BagId)">删除</button>
                                                </td>
                                            </tr>
                                       


                                    </tbody>
                                    @*<tfoot>
                                            <tr>

                                                <th>包裹号</th>
                                                <th>寄出日期</th>
                                                <th>收件人姓名</th>
                                                <th>收件人电话</th>
                                                <th>收件人地址</th>
                                                <th>寄件人姓名</th>
                                                <th>寄件人电话</th>
                                                <th>寄件人地址</th>
                                                <th>寄件信息</th>
                                                <th>更新日期</th>
                                                <th>操作</th>
                                            </tr>
                                        </tfoot>*@
                                </table>
                                <ul class="pagination pull-right">
                                    <li v-if="getterPage<=1" class="page-item disabled"><a class="page-link">&laquo;</a></li>
                                    <li v-else class="page-item"><a href="" v-on:click.prevent="changePage(page-1,'getter')" class="page-link">&laquo;</a></li>
                                    <li v-for="i in getterTotalPages"  class="page-item"><a href="" v-on:click.prevent="changePage(i,'getter')" class="page-link">{{i}}</a></li>
                                    <li v-if="getterPage>=getterTotalPages" class="page-item disabled"><a class="page-link">&raquo;</a></li>
                                    <li v-else class="page-item"><a href="" v-on:click.prevent="changePage(page+1,'getter')" class="page-link">&raquo;</a></li>
                                </ul>

                            </div>

                        </div>
                    </section>
                </div>
            </div>
        }
        else
        {
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">

                        <header class="panel-heading">
                            快递信息汇总
                            <span class="tools pull-right">
                                <a href="javascript:;" class="fa fa-chevron-down"></a>
                                <a href="javascript:;" class="fa fa-times"></a>
                            </span>
                        </header>
                        <div class="panel-body">
                            <div class="adv-table">
                                <table class="display table table-bordered table-striped" @*id="dynamic-table2"*@>
                                    <thead>
                                        <tr>

                                            <th>包裹号</th>
                                            <th>寄出日期</th>
                                            <th>收件人姓名</th>
                                            <th>收件人电话</th>
                                            <th>收件人地址</th>
                                            <th>寄件人姓名</th>
                                            <th>寄件人电话</th>
                                            <th>寄件人地址</th>
                                            <th>寄件信息</th>
                                            <th>更新日期</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody id="table_body_total">
                                 

                                            <tr v-for="item in totalList" class="gradeA">
                                                <td  class="center hidden-phone">{{item.BagId}}</td>
                                                <td class="center hidden-phone">
                                                    {{formatDateTime2(item.SendDate)}}
                                                </td>
                                                <td class="center hidden-phone">{{item.GetterName}}</td>
                                                <td class="center hidden-phone">{{item.GetterPhone}}</td>
                                                <td class="center hidden-phone">{{item.GetterAddress}}</td>
                                                <td class="center hidden-phone">{{item.SenderName}}</td>
                                                <td class="center hidden-phone">{{item.SenderPhone}}</td>
                                                <td class="center hidden-phone">{{item.SenderAddress}}</td>
                                                <td class="center hidden-phone">{{item.SendInfo}}</td>
                                                <td class="center hidden-phone">{{formatDateTime2(item.UpdateTime)}}</td>
                                                <td class="center hidden-phone">
                                                    <button  class="btn btn-default" type="button" data-toggle="modal" data-target="#dispModal" v-on:click="get_info(item.BagId,'r')">查看</button>
                                                    <button  class="btn btn-info" type="button" data-toggle="modal" data-target="#updateModal" v-on:click="get_info(item.BagId,'w')">修改</button>
                                                    <button  class="btn btn-danger" type="button" data-toggle="modal" data-target="#delModal" v-on:click="delete_info(item.BagId)">删除</button>
                                                </td>
                                            </tr>
                                    


                                    </tbody>
                                    @*<tfoot>
                                            <tr>

                                                <th>包裹号</th>
                                                <th>寄出日期</th>
                                                <th>收件人姓名</th>
                                                <th>收件人电话</th>
                                                <th>收件人地址</th>
                                                <th>寄件人姓名</th>
                                                <th>寄件人电话</th>
                                                <th>寄件人地址</th>
                                                <th>寄件信息</th>
                                                <th>更新日期</th>
                                                <th>操作</th>
                                            </tr>
                                        </tfoot>*@
                                </table>
                                <ul class="pagination pull-right">
                                    <li v-if="page<=1" class="page-item disabled"><a class="page-link">&laquo;</a></li>
                                    <li v-else class="page-item"><a href="" v-on:click.prevent="changePage(page-1,'total')" class="page-link">&laquo;</a></li>
                                    <li v-for="i in totalPages"  class="page-item"><a href="" v-on:click.prevent="changePage(i,'total')" class="page-link">{{i}}</a></li>
                                    <li v-if="page>=totalPages" class="page-item disabled"><a class="page-link">&raquo;</a></li>
                                    <li v-else class="page-item"><a href="" v-on:click.prevent="changePage(page+1,'total')" class="page-link">&raquo;</a></li>
                                </ul>
                            </div>

                        </div>
                    </section>

                </div>
            </div>
        }

    </div>
    @*{page_str} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*@
    <!-- 模态框示例（Modal） -->
    <form method="post" Action="" class="form-horizontal" role="form" id="form_data"  style="margin: 20px;">
        <div class="modal fade" id="dispModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            快件详细信息
                        </h4>
                    </div>
                    <div class="modal-body">
                            <div class="form-group">
                                <label for="user_id" class="col-sm-3 control-label">包裹号</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="BagId" name="user_id" disabled="">

                                </div>
                            </div>
                            <div class="form-group">
                                <label for="lastname" class="col-sm-3 control-label">寄出日期</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="SendDate" name="SendDate" disabled="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="lastname" class="col-sm-3 control-label">收件人姓名</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="GetterName" name="GetName" disabled="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">收件人电话</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="GetterPhone" name="GetPhone" disabled="">
                                    @*<textarea class="form-control" name="remark" value="{remark}" id="remark"
                                        placeholder="备注">*@
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">收件人地址</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="GetterAddress" name="GetAddress" disabled="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">寄件人姓名</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="SenderName" name="SenderName" disabled="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">寄件人电话</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="SenderPhone" name="SenderPhone" disabled="">

                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">寄件人地址</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="SenderAddress" name="SenderAddress" disabled="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">寄件信息</label>
                                <div class="col-sm-9">
                                    <textarea class="form-control" name="remark" v-model="SendInfo"  disabled="">
                                </textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">更新日期</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="UpdateTime" name="UpdateTime" disabled="">
                                </div>
                            </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">
                            关闭
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </form>

    <!-- 模态框示例（Modal） -->
    <form method="post" Action="" class="form-horizontal" role="form" id="form_data"  style="margin: 20px;">
        <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close"  data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            快件详细信息
                        </h4>
                    </div>
                    <div class="modal-body">
                            <div class="form-group">
                                <label for="user_id" class="col-sm-3 control-label">包裹号</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="BagId" name="update_bagID">

                                </div>
                            </div>
                            <div class="form-group">
                                <label for="lastname" class="col-sm-3 control-label">寄出日期</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="SendDate" name="update_sendDate">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="lastname" class="col-sm-3 control-label">收件人姓名</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="GetterName" name="update_getName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">收件人电话</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="GetterPhone" name="update_getPhone">
                                    @*<textarea class="form-control" name="remark" value="{remark}" id="remark"
                                        placeholder="备注">*@
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">收件人地址</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="GetterAddress" name="update_getAddress">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">寄件人姓名</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="SenderName" name="update_sendName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">寄件人电话</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="SenderPhone" name="update_sendPhone">

                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">寄件人地址</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="SenderAddress" name="update_sendAddress">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">寄件信息</label>
                                <div class="col-sm-9">
                                    <textarea class="form-control" v-model="SendInfo" name="update_sendInfo">
                                </textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label">更新日期</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" v-model="UpdateTime" name="update_updateDate">
                                </div>
                            </div>
                    </div>
                    <div class="modal-footer">
                        <button  type="button" class="btn btn-default" data-dismiss="modal">
                            关闭
                        </button>
                        <button type="button" v-on:click="check_form('update')" class="btn btn-primary">
                            提交
                        </button><span id="tip"> </span>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </form>

    <!-- 模态框示例（Modal） -->
    <form method="post" class="form-horizontal" role="form" id="form_data"  style="margin: 20px;">
        <div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close"  data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            快件信息删除确认
                        </h4>
                    </div>
                    <div class="modal-body">
                            <div class="form-group">
                                <label for="remark" class="col-sm-3 control-label center ">确认要删除吗?</label>
                                @*<div class="col-sm-9">
                                        <input type="text" class="form-control" id="update_updateDate" name="UpdateTime">
                                    </div>*@
                            </div>
                    </div>
                    <div class="modal-footer">
                        <button  type="button" class="btn btn-default" data-dismiss="modal">
                            取消
                        </button>
                        <!-- <button type="button" onclick="trigger_delete()" class="btn btn-primary" data-dismiss="modal">
                            确认
                        </button><span id="tip"> </span> -->
                        <button type="button" v-on:click="check_form('delete')" class="btn btn-primary">
                            提交
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </form>
</section>


@section JavascriptLink{


}
@section Javascript{

    <script>
              var vm = new Vue({
                el: "#app",
                  data: {
                   mode :'',
                   senderList: [],
                   getterList: [],
                   totalList:[],
                      page: 1,
                      getterPage: 0,
                      senderPage:0,
                   senderTotalPages: 1,
                   getterTotalPages:1,
                   totalPages: 1,
                   Action:'keep',
                   TrueName: '',
                   Idcard: '',
                   AddTime: '',
                   UpdateTime: '',
                   Address:'',
                   Email: '',
                   ContactAddress: '',
                   Title:'',
                   Info: '',
                   SubmitTime: '',
                   ReplyInfo: '',
                   ReplyTime: '',
                   BagId: '',
                   SendDate: '',
                   GetterName: '',
                   SenderName: '',
                   SenderPhone: '',
                   SenderAddress: '',
                   SendInfo: '',
                   UpdateInfo: '',
                   UpdateTime:'',
                   GetterPhone: '',
                   GetterAddress:'',
                },
               methods: {

                   formatDateTime : function (str) {
                       if (!str) return str;
                       var now = new Date(parseInt(str.replace("/Date(", "").replace(")/", ""), 10));
                       var year = now.getFullYear();  //取得4位数的年份
                       var month = now.getMonth() + 1;  //取得日期中的月份，其中0表示1月，11表示12月
                       var date = now.getDate();      //返回日期月份中的天数（1到31）
                       var hour = now.getHours();     //返回日期中的小时数（0到23）
                       var minute = now.getMinutes(); //返回日期中的分钟数（0到59）
                       var second = now.getSeconds(); //返回日期中的秒数（0到59）
                       return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
                   },
                    formatDateTime2:function(str) {
                        if (!str) return str;
                        ////console.log(str);
                        var now = new Date(str);
                        var year = now.getFullYear();  //取得4位数的年份
                        var month = now.getMonth() + 1;  //取得日期中的月份，其中0表示1月，11表示12月
                        /*   if (month < 10) month = '0' + month;*/
                        var date = now.getDate();      //返回日期月份中的天数（1到31）
                        //if (date < 10) date = '0' + date;
                        var hour = now.getHours();     //返回日期中的小时数（0到23）
                        //if (hour < 10) hour = '0' + hour;
                        var minute = now.getMinutes(); //返回日期中的分钟数（0到59）
                        if (minute < 10) minute = '0' + minute;
                        var second = now.getSeconds(); //返回日期中的秒数（0到59）
                        if (second < 10) second = '0' + second;
                        return year + "/" + month + "/" + date + " " + hour + ":" + minute + ":" + second;
                    },


                   delete_info: function (id) {
                       this.BagId = id;
                        },
                                // 编辑表单
                    get_info: function (id, type) {
                          
                            if (id == null) {
                                alert('Error！');
                                return false;
                            }
                            id = id.toString();
                            var sendData = new FormData();
                            sendData.append('BagId', id);
                            sendData.append('Action', $('#act').val());

                            if (id == null) {
                                alert('Error！');
                                return false;
                            }
                        id = id.toString();
                        ////console.log(sendData);
                        axios({
                            method: "get",
                            params: {
                            BagId:id,
                            Action: $('#act').val()
                            },
                            //sendData
                                responseType: 'json',
                                // `transformRequest` 允许在向服务器发送前，修改请求数据
                                // 只能用在 'PUT', 'POST' 和 'PATCH' 这几个请求方法
                                // 后面数组中的函数必须返回一个字符串，或 ArrayBuffer，或 Stream
                                transformRequest: [function (data) {
                                    // 对 data 进行任意转换处理
                                    return data;
                                }],
                                // `transformResponse` 在传递给 then/catch 前，允许修改响应数据
                                transformResponse: [function (data) {
                                    // 对 data 进行任意转换处理
                                    return data;
                                }],
                                url: "@Url.Action("GetItemByID", "Bag")"

                            }).then((data) => {
                                ////console.log(data);
                                // 解析json数据
                                //var data = data;
                                //var data_obj = eval("(" + data + ")");
                                // 将JSON编码的字符串转换为JS对象
                                var data_obj = JSON.parse(data.data);
                                //tool =  new datesFn();
                           
                                // 赋值
                                vm.BagId = data_obj.BagId;
                                vm.SendDate = this.formatDateTime(data_obj.SendDate) ;
                                vm.GetterName = data_obj.GetterName;
                                vm.GetterPhone = data_obj.GetterPhone;
                                vm.GetterAddress = data_obj.GetterAddress;
                                vm.SenderName = data_obj.SenderName;
                                vm.SenderPhone = data_obj.SenderPhone;
                                vm.SenderAddress = data_obj.SenderAddress;
                                vm.SendInfo = data_obj.SendInfo;
                                vm.UpdateTime=this.formatDateTime(data_obj.UpdateTime); 
                            }).catch(error => {
                                alert(error);
                            });

                        },
                        // 提交表单
                   check_form: function (act) {

                           var id = vm.BagId;
                            if (!id) {
                                alert('快递BagId不能为空！');
                                return false;
                            }
                            var modal = '';
                           var sendData = new FormData();
                             var sendUrl = '';

                            if (act == 'update') {
                                modal = $('#updateModal');
                                sendUrl = "@Url.Action("Update", "Bag")";
                                sendData.append('BagId', this.BagId);
                                sendData.append('Action', act);
                                //sendData.append('SendDate', this.sendData);
                                sendData.append('GetterName', this.GetterName);
                                sendData.append('GetterPhone', this.GetterPhone);
                                sendData.append('GetterAddress', this.GetterAddress);
                                sendData.append('SenderName', this.SenderName);
                                sendData.append('SenderPhone', this.SenderPhone);
                                sendData.append('SenderAddress', this.SenderAddress);
                                sendData.append('SendInfo', this.SendInfo);
                                sendData.append('UpdateTime', this.UpdateTime);

                            } else if (act == 'delete') {
                                modal = $('#delModal');
                                sendUrl = "@Url.Action("Delete", "Bag")";
                                sendData.append('BagId', vm.BagId);
                                sendData.append('Action', act);
                            }
                            ////console.log(sendData);

                            ////console.log(sendData);
                            // 异步提交数据到Action/GetBagItemByID页面
                            axios({
                                url: sendUrl,
                                method: "post",
                                responseType: 'json',
                                data: sendData,
                                transformRequest: [function (data) {
                                    // 对 data 进行任意转换处理
                                    return data;
                                }],
                                // `transformResponse` 在传递给 then/catch 前，允许修改响应数据
                                transformResponse: [function (data) {
                                    // 对 data 进行任意转换处理
                                    return data;
                                }],

                            }).then((data) => {
                                ////console.log(data);
                                // 将JSON编码的字符串转换为JS对象
                                if (data.data > 0) {
                                    commonUtil.message('成功',  "", 'success');
                                    modal.modal('hide');
                                    if ('@loginType' == "用户") {
                                        this.changePage(this.senderPage, 'sender');
                                        this.changePage(this.getterPage, 'getter');
                                    } else {
                                        this.changePage(this.page, 'total');
                                      }
                                }
                                else {
                                    alert('操作失败');
                                    modal.modal('hide');
                                }
                            }).catch(error => {
                                alert(error);
                            });

                    },


                    changePage: function (page,mode) {
                        this.mode = mode;
                        data = {};
                        if (mode == "sender") {
                            data = {
                                senderPage: page,
                                Action: mode
                            };
                            //formdata.append('senderPage', page);
                            //formdata.append('Action', mode);

                        } else if (mode == "getter") {
                            //formdata.append('getterPage', page);
                            //formdata.append('Action', mode);
                            data = {
                                getterPage: page,
                                Action: mode
                            };
                        } else {
                            data = {
                                pageNum: page,
                                Action: mode
                            };
                            //formdata.append('pageNum', page);
                            //formdata.append('Action', mode);
                        }
                        //console.log(mode);

                        axios({
                            method: "get",
                            responseType: 'json',
                            params: data,
                            //data: formdata,
                                transformRequest: [function (data) {
                                    // 对 data 进行任意转换处理
                                    return data;
                                }],
                                // `transformResponse` 在传递给 then/catch 前，允许修改响应数据
                                transformResponse: [function (data) {
                                    // 对 data 进行任意转换处理
                                    return data;
                                }],
                                url: "@Url.Action("ChangePage", "Bag")"
                        }).then((data) => {
                       
                            data = JSON.parse(data.data);
                            ////console.log("收到的总集合",data);   
                            totalPages = parseInt(data.totalPages);
                              ////console.log("收到的总页数",totalPages); 
                            mode =data.action;
                              ////console.log("收到的mode'",mode); 
                            dataArr = JSON.parse(data.data);
                             ////console.log("收到的arr'",dataArr); 
                    

                            this.page = page;
                                ////console.log(this.totalPages);
                            if (mode == "sender") {
                                this.senderPage = page;
                                this.senderList = dataArr;
                                this.senderTotalPages = totalPages;
                                ////console.log(this.page, this.senderTotalPages);
                            } else if (mode == "getter") {
                                this.getterPage = page;
                                this.getterList = dataArr;
                                this.getterTotalPages =   totalPages;

                            } else {
                                this.page = page;
                                this.totalList = dataArr;
                                this.totalPages = totalPages;
                           }

                                ////console.log(managers);
/*                                vm.$forceUpdate();*/
                                //this.FillTable(data);
                            }).catch(error => {
                                alert(error);
                            });

                    }
                },
                watch: {
                    //userName: {
                    //    deep: true,
                    //    handler(obj) {
                    //        //console.log(obj);
                    //    }
                    //},

               },
              mounted: function () {
                  ////console.log('@loginType');
                  if ('@loginType'=="用户") {
                      //console.log("身份是用户");
                      this.changePage(0, 'sender');
                      sleep(50);
                      this.changePage(0, 'getter');
                  } else {

                      this.changePage(0, 'total');
                  }
               },
               created() {
                   var act = $('#act').val()
                    $('#updateModal').on('hide.bs.modal', function () {
                        // 关闭时清空edit状态为add
                        ////console.log($('#act').val());
                        if (act != 'keep') {
                              if ('@loginType'=="用户") {
                                  this.changePage(0, 'sender');
                                  sleep(50);
                                  this.changePage(0, 'getter');
                              } else {
                                  this.changePage(0, 'total');
                              }
                            //location.reload();
                        }
                    });
                    $('#delModal').on('hide.bs.modal', function () {
                        // 关闭时清空edit状态为add
                        if (act != 'keep') {
                            //location.reload();
                             if ('@loginType'=="用户") {
                                  this.changePage(0, 'sender');
                                  sleep(50);
                                  this.changePage(0, 'getter');
                              } else {
                                  this.changePage(0, 'total');
                              }
                        }

                    });
                }
            });
    </script>
}